import {createRouter, createWebHistory} from 'vue-router'

const routes = [
    {
        path: '/',
        redirect:'/user',
        component:()=>import("../layout/Layout"),
        children:[

            {
                path:"/home",
                name:"主页",
                component:()=>import("@/views/Home")
            },
            {
                path:"/user",
                name:"用户管理",
                component:()=>import("@/views/User")
            },
            {
                path:"/game",
                name:"比赛管理",
                component:()=>import("@/views/Game")
            },
            {
                path:"/test",
                name:"测试",
                component:()=>import("@/views/test")
            },
            {
                path: '/person',
                name: '个人信息',
                component: () => import("@/views/Person"),
            },
            {
                path: '/rules',
                name: '规则信息',
                component: () => import("@/views/rules/Rules"),
            },
        ]
    },
    {
        path: '/login',
        name: '登录',
        component: () => import("@/views/Login"),
    },

    {
        path: '/register',
        name: '注册',
        component: () =>import("@/views/Register")
    },
    {
        path: '/correct',
        redirect: "/works",
        name: '评阅',
        component: () =>import("@/layout/CorrectWrapper"),
        children:[
            {
                path: '/works',
                name: '作品',
                component: () =>import("@/views/Works"),
                children:[
                    {
                        path: '/single',
                        name: '单项打分',
                        component: () =>import("@/views/rules/single")
                    },
                    {
                        path: '/double',
                        name: '双项打分',
                        component: () =>import("@/views/rules/double")
                    },
                ]
            },
            {
                path: '/grade',
                name: '总成绩',
                component: () =>import("@/views/summaryGrade")
            },

        ]
    },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
